<table width='100%' border='0' cellspacing='0' cellpadding='0' style="padding: 0 0 8px 0;">
<tr>
  <td width=120>
    <label>Изображение</label><br/>
    <div><img id='image_preview' src="/shared/cms/images/1x1.gif"/></div>
  </td>
  <td align=left>
    <span id='image_path'></span>
    {{input type='hidden' name='image_id' id='image_id' /}}
    {{input type='button' value='...' onclick='return onButtonClick();' runat='client' style="width:20px"/}}
    {{input type='button' value='Reset' onclick='return onResetClick();' runat='client'/}}
  </td>
</tr>
</table>



<script type="text/javascript">
function onButtonClick()
{
  new Limb.Window('/admin_media/browse?Type=Image', 'image_select');
  return false;
}

function onResetClick()
{
  var image = document.getElementById('image_preview');
  if(!image) return;
  image.src = "/shared/cms/images/1x1.gif";

  var image_id = document.getElementById('image_id');
  if(!image_id) return;
  image_id.value = null;
}

function SetUrl(url, id)
{
  var image = document.getElementById('image_preview');
  if(!image) return;
  image.src = '/admin_image/show/' + id;

  var image_id = document.getElementById('image_id');
  if(!image_id) return;
  image_id.value = id;
}

function InitImageSelect()
{
  var image_id = document.getElementById('image_id');
  if(!image_id || !image_id.value|| (image_id.value==0)||(image_id==null) ) return;

  var url = '/admin_image/show/' + image_id.value;

  var image = document.getElementById('image_preview');
  if(!image) return;
  image.src = url;
}

jQuery(window).ready(InitImageSelect());
//Limb.events.add_event(window, 'load', InitImageSelect);
</script>
